<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="/jsp/inc/header.jsp" %>
<c:set var="title" value="分类"/>
<c:set var="rootpath" value="${CONTEXT_PATH}/admin/product/cate/"/>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<link href="${STATIC_HOST}/css/ligerui.css" rel="stylesheet" type="text/css"/>
	<link href="${STATIC_HOST}/css/common.css" rel="stylesheet" type="text/css" />

	<script src="${STATIC_HOST}/js/jquery/jquery-1.7.2.min.js" type="text/javascript" ></script>    <!--兼容性问题--->
	<script src="${STATIC_HOST}/js/ligerUI/ligerui.min.js" type="text/javascript"></script>
	<script src="${STATIC_HOST}/js/json/json2.js" type="text/javascript"></script>
	<script src="${STATIC_HOST}/js/LG.js" type="text/javascript"></script>
	<script src="${STATIC_HOST}/js/ckeditor/ckeditor.js" type="text/javascript"></script>

    <title>${title}管理</title>
</head>
<body>
<form:form commandName="cate" class="l-form" id="mainform" name="mainform" method="post" action="${rootpath}/save.do">
  <div class="l-group l-group-hasicon"><img src="${STATIC_HOST}/images/common/communication.gif"><span>当前位置: 宇宙CMS &gt; <a href="${rootpath}/list.do">${title}管理</a> &gt; ${cate.id==0 ? '新增' : '修改'}${title}</span></div>
    <div id="errorLabelContainer"> <form:errors path="*"/></div>
        <input type="hidden" name="queryParam" value="${queryParam}"/>
		<input type="hidden" name="id" id="id" value="${cate.id}"/>
		
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="typeId">分类类型</label> <span style="color:red">*</span>:</li>
		  <li class="li_show_right" id="quickTypeId">
			  <span class="quickSearch <c:if test="${cate.typeId==1}">point</c:if>" name="typeId" value="1" onclick="setDefaultValue(1)">汽车品牌</span>|
			  <span class="quickSearch <c:if test="${cate.typeId==2}">point</c:if>" name="typeId" value="2" onclick="setDefaultValue(2)">汽车车系</span>|
			  <span class="quickSearch <c:if test="${cate.typeId==3}">point</c:if>" name="typeId" value="3" onclick="setDefaultValue(3)">汽车类型</span>|
			  <span class="quickSearch <c:if test="${cate.typeId==5}">point</c:if>" name="typeId" value="5" onclick="setDefaultValue(5)">手表品牌</span>|
			  <input type="hidden" name="typeId" id="typeId" value="${cate.typeId}">
		  </li>
      </ul><!--换行-->
	<ul>
		<li class="li_show_left" style="padding-left:30px;"><label for="parentId">父分类ID</label> <span style="color:red">*</span>:</li>
		<li class="li_show_right">
			<input type="text" name="parentId" id="parentId" size="60" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${cate.parentId}"/>
			<input value="..." type="button" class="l-button ellipsis"  onclick="f_select({'targetId':'parentId','selectType':'/admin/product/cate'})">
		</li>
	</ul><!--换行-->
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="name">名称</label> <span style="color:red">*</span>:</li>
			   <li class="li_show_right">
			<input type="text" name="name" id="name" size="60" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${cate.name}"/>
		   <span class='formValidatorError'><form:errors path="name" /></span>
		  </li>
      </ul><!--换行-->
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="initialWord">首字母</label> <span style="color:red">*</span>:</li>
			   <li class="li_show_right">
			<input type="text" name="initialWord" id="initialWord" size="60" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${cate.initialWord}"/>
		   <span class='formValidatorError'><form:errors path="initialWord" /></span>
		  </li>
      </ul><!--换行-->

	<ul>
		<li class="li_show_left" style="padding-left:30px;"><label for="initialWord">图标</label> <span style="color:red">*</span>:</li>
		<li class="li_show_right">
			<input type="text" name="logo" id="logo" size="60" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${cate.logo}"/>
			<img src="http://static.21cnimg.com/img/icons/silkicons/add.png" title="添加" alt="添加" style="cursor: pointer;"
				 onclick="f_select({'selectType':'/jsp/admin/resource/picture/uploads.jsp?multi=0&noConfirm=1','dialogWidth':'700','dialogHeight':'500','callback':'setFirstPicUrl'})"/>
		</li>
	</ul><!--换行-->

      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="sortNum">排序号</label> <span style="color:red">*</span>:</li>
			   <li class="li_show_right">
			<input type="text" name="sortNum" id="sortNum" size="60" maxlength="100" ltype='text'  validate="{required:true,minlength:0,maxlength:100}" value="${cate.sortNum}"/>
		   <span class='formValidatorError'><form:errors path="sortNum" /></span>
		  </li>
      </ul><!--换行-->
      <ul>
		  <li class="li_show_left" style="padding-left:30px;"><label for="status">状态</label> <span style="color:red">*</span>:</li>
		  <li class="li_show_right">
			  <select name="status" id="status" ltype="select" size="1" >
				  <c:forEach var="obj" items="${statusMap}" varStatus="idx">
					  <option value="${obj.key}" <c:if test="${cate.status==obj.key}">selected</c:if>>${obj.value}</option>
				  </c:forEach>
			  </select>
		  </li>
      </ul><!--换行-->
		<ul>
			<li class="li_show_left" style="padding-left:30px;"><label for="memo">备注</label>:</li>
			<li class="li_show_right">
				<textarea name="memo" id="memo" rows="3" cols="80" class="l-textarea" validate="{minlength:0,maxlength:420}">${cate.memo}</textarea>
				<span class='formValidatorError'><form:errors path="memo" /></span>
			</li>
		</ul><!--换行-->
  <div class="l-group l-group-hasicon"></div> 
  <input type="submit" value="提交" id="mainformsubmit" class="l-button l-button-submit form_submit_button"/> 
  <c:if test="${fn:contains(header.referer,rootpath)}"><input type="button" value="返回" class="l-button l-button-test" style="float:left;" onClick="location.href='${header.referer}'" /></c:if>
</form:form>
<script type="text/javascript" >
var mainform = $("#mainform");
mainform.ligerForm();

function setDefaultValue(id){
	jQuery("#quickTypeId span[value="+id+"]").addClass("point");
	jQuery("#quickTypeId span[value="+id+"]").siblings().removeClass("point");
	jQuery("#typeId").val(id);
}

function setFirstPicUrl(jsonData) {
	var data= jQuery.parseJSON(jsonData);
	var html = "";
	for(var i=0 ; i< data.length; i++){
		var title = data[i].title;
		var src = data[i].url;
		jQuery("#logo").val(src);
	}
}


</script>
<div id="scrolltop">返回顶部</div>
<%@ include file="/jsp/inc/footer.jsp"%>
</body>
</html>